/**
 * 
 */
package edu.gatech.tests;

import java.util.ArrayList;

import edu.gatech.userclasses.Doctor;
import edu.gatech.userclasses.Nurse;
import edu.gatech.userclasses.Patient;
import edu.gatech.userclasses.SysAdmin;
import edu.gatech.userclasses.User;
import edu.gatech.userclasses.UserType;
import edu.gatech.utilities.Persistence;

import junit.framework.TestCase;

/**
 * 
 * @author Dan Holdridge
 *
 */
public class AddUserTests extends TestCase{
	
	/**A new instance of SysAdmin to run the tests*/
	public SysAdmin testAdmin = new SysAdmin("Bob the Tester");
		
	public void setUp(){
		try {
			super.setUp();
		} catch (Exception e) {
			// TODO Auto-generated catch block
			e.printStackTrace();
		}
		Persistence.setUserList(new ArrayList<User>());
	}
	
	public void test1(){
		Patient p = new Patient("Joe Long", "eewew5AhTai");
		assertTrue(testAdmin.addUser("Joe Long", "eewew5AhTai", UserType.NURSE));
		assertEquals(p, testAdmin.searchUsers("Joe Long"));
	}
	
	public void test2(){
		assertFalse(testAdmin.addUser(null, "geYejai3i", UserType.NURSE));
	}
	
	public void test3(){
		assertFalse(testAdmin.addUser("Gary Hammer", null, UserType.NURSE));

	}
	
	public void test4(){
		assertFalse(testAdmin.addUser(null, null, UserType.NURSE));
	}
	
	public void test5(){
		Patient p = new Patient("", "");
		assertTrue(testAdmin.addUser("", "", UserType.PATIENT));
		assertEquals(p, testAdmin.searchUsers(""));
	}
	
	public void test6(){
		Nurse n = new Nurse("Rosemary Maag", "Fe8seega");
		assertTrue(testAdmin.addUser("Rosemary Maag", "Fe8seega", UserType.NURSE));
		assertEquals(n, testAdmin.searchUsers("Rosemary Maag"));
	}
	
	public void test7(){
		assertFalse(testAdmin.addUser(null, "Wa9euqu5gum", UserType.NURSE));
	}
	
	public void test8(){
		assertFalse(testAdmin.addUser("Andrea Whisenant", null, UserType.NURSE));

	}
	
	public void test9(){
		assertFalse(testAdmin.addUser(null, null, UserType.NURSE));
	}
	
	public void test10(){
		Nurse n = new Nurse("", "");
		assertTrue(testAdmin.addUser("", "", UserType.NURSE));
		assertEquals(n, testAdmin.searchUsers(""));
	}
	
	public void test11(){
		Doctor d = new Doctor("Antoinette Walters", "om9eZ3u");
		assertTrue(testAdmin.addUser("Antoinette Walters", "om9eZ3u", UserType.DOCTOR));
		assertEquals(d, testAdmin.searchUsers("Antoinette Walters"));
	}
	
	public void test12(){
		assertFalse(testAdmin.addUser(null, "CieSa2oan", UserType.DOCTOR));
	}
	
	public void test13(){
		assertFalse(testAdmin.addUser("Ed Rothe", null, UserType.DOCTOR));

	}
	
	public void test14(){
		assertFalse(testAdmin.addUser(null, null, UserType.DOCTOR));
	}
	
	public void test15(){
		Doctor d = new Doctor("", "");
		assertTrue(testAdmin.addUser("", "", UserType.DOCTOR));
		assertEquals(d, testAdmin.searchUsers(""));
	}
	
	public void test16(){
		SysAdmin p = new SysAdmin("Fred Brown", "shaXohTi5O");
		assertTrue(testAdmin.addUser("Fred Brown", "shaXohTi5O", UserType.SYSADMIN));
		assertEquals(p, testAdmin.searchUsers("Fred Brown"));
	}
	
	public void test17(){
		assertFalse(testAdmin.addUser(null, "ko6Viedekae", UserType.SYSADMIN));
	}
	
	public void test18(){
		assertFalse(testAdmin.addUser("Willie Mullins", null, UserType.SYSADMIN));

	}
	
	public void test19(){
		assertFalse(testAdmin.addUser(null, null, UserType.SYSADMIN));
	}
	
	public void test20(){
		SysAdmin p = new SysAdmin("", "");
		assertTrue(testAdmin.addUser("", "", UserType.SYSADMIN));
		assertEquals(p, testAdmin.searchUsers(""));
	}

}
